package com.android.scj.tc.bean;

/**
 *
 *  PSAM通道请求
 *	@author LiuYaDong
 */
public class PSAMPassResponse {
	/**
	 * 	0	1	Status	0x00表示正常返回，0x01表示无响应
	 1	1	响应指令数
	 2	1	数据1长度
	 3	n	数据1内容

	 */
	private static final String cmdcode = "E9";
	private String Status = "";
	private String cmdconut = "";
	private String context = "";
	private CMD_55AA cmd = null;

	private PSAMPassResponse(){}

	public static PSAMPassResponse disassemble(String cmdstr) {
		PSAMPassResponse p = new PSAMPassResponse();
		p.cmd = CMD_55AA.disassemble(cmdstr);
		if(p.cmd == null||!p.cmd.getCMD().equals(cmdcode)||p.cmd.getDATA().length() < 4||p.cmd.getDATA().length()%2==1)return null;
		p.Status = p.cmd.getDATA().substring(0,2);
		p.cmdconut = p.cmd.getDATA().substring(2,4);
		p.context = p.cmd.getDATA().substring(4);
		return p;
	}

	public String getStatus() {
		return Status;
	}
	public String getCmdconut() {
		return cmdconut;
	}
	public String getContext(){
		return context;
	}

}
